//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.hl.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hl.sfzy.entity.Toll;
import com.hl.sfzy.mapper.TollMapper;
import com.hl.sfzy.service.TollService;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TollServiceImpl implements TollService {
    @Autowired
    private TollMapper tollMapper;

    public TollServiceImpl() {
    }

    public void add(Toll entity) throws Exception {
        this.tollMapper.insert(entity);
    }

    public void edit(Toll entity) {
        this.tollMapper.update(entity);
    }

    public void remove(Integer id) {
        this.tollMapper.delete(id);
    }

    public void removeBatch(Integer[] ids) {
        this.tollMapper.deleteBatch(ids);
    }

    public List<Toll> find(Toll entity) {
        return this.tollMapper.select(entity);
    }

    public Map<String, Object> findPage(Integer pageNum, Integer pageSize, Toll entity) {
        PageHelper.startPage(pageNum, pageSize);
        List<Toll> tollList = this.tollMapper.select(entity);
        PageInfo<Toll> pageInfo = new PageInfo(tollList);
        Map<String, Object> pageMap = new HashMap();
        pageMap.put("list", tollList);
        pageMap.put("total", pageInfo.getTotal());
        return pageMap;
    }

    public Toll findById(Integer id) {
        return (Toll)this.tollMapper.selectById(id);
    }
}
    
